package com.kaifamiao.QuickHit;

import java.util.Scanner;

// 玩家信息类
public class Player {

    private int levelNo; // 级别号
    private int cutScore; // 当前级别积分
    private long startTime; // 当前级别开始时间
    private long endTime; // 当前级别结束时间
    private int reborn = 3; // 当前剩余复活次数
    private int elapsedTime; // 当前级别已用时间

    public Player() {
    }

    public int getLevelNo() {
        return levelNo;
    }

    public void setLevelNo(int levelNo) {
        this.levelNo = levelNo;
    }

    public int getCutScore() {
        return cutScore;
    }

    public void setCutScore(int cutScore) {
        this.cutScore = cutScore;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public int getElapsedTime() {
        return elapsedTime;
    }

    public void setElapsedTime(int elapsedTime) {
        this.elapsedTime = elapsedTime;
    }

    public int getReborn() {
        return reborn;
    }

    public void setReborn(int reborn) {
        this.reborn = reborn;
    }

    public void play() {
        System.out.println("欢迎来到QuickHit游戏--本游戏考验用户键盘输入内容的速度和准确性！");
        System.out.println("请按照屏幕提示内容输入字符：");
        Game game = new Game(this);
        Scanner in = new Scanner(System.in);
        for (int i = 0; i < LevelArrayList.levelArrays.length; i++) {
            this.levelNo += 1;
            this.setStartTime(System.currentTimeMillis()); // 记录游戏开始的时间
            this.cutScore = 0;
            if (this.levelNo == 2) {
                System.out.println("***************************");
                System.out.println("******Congratulations******");
                System.out.println("****Completed The Level****");
                System.out.println("***************************");
                return;
            }
            // 控制用户的输入次数 getStrTimes() 每个等级的用户输入次数
            for (int j = 0; j < LevelArrayList.levelArrays[levelNo - 1].getStrTimes(); j++) {
                String printStr = game.printStr(); // 系统输出的字符串
                String inputStr = in.nextLine(); // 用户输入字符串
                game.printResult(printStr, inputStr); // 判断两个字符串
            }
        }

    }
}
